<?php
namespace app\seller\validate;

use pidan\Validate;

class Seller extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
			'email'    => 'require|email|unique:user,email',
			'password' => 'require|regex:^[\S]{6,50}$',
			'nickname' => 'require|regex:^[A-Za-z][A-Za-z0-9\-\_ ]+[A-Za-z0-9]$',
    ];

    /**
     * 提示消息
     */
    protected $message = [
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
			'add'  => ['email', 'password', 'nickname'],
			'edit'  => ['email', 'password', 'nickname'],
    ];

    public function __construct()
    {
        $this->field = [
            'email' => lang('email'),
            'password'=> lang('password'),
            'nickname'=> lang('nickname'),
        ];
        $this->message = array_merge($this->message, [
					'password.regex' => lang('the password must contain 6 to 12 characters without spaces'),
					'nickname.regex' => lang('nicknames cannot have special characters')
        ]);
        parent::__construct();
    }



}
